#ifndef _NOTIFY_HANDER_410FF986_D4A4_4939_8C7A_8512D4932E26_
#define _NOTIFY_HANDER_410FF986_D4A4_4939_8C7A_8512D4932E26_
#include "common/download.h"

__int64 first_position = 0;

class NotifyHandler : public IDownloadProxy::NotifyDelegate {
private:
  CEdit hint_;
public:
  NotifyHandler() { hint_ = NULL; }

  void SetHintCtrl(HWND ctrl) {
    hint_.Attach(ctrl);
  }

  virtual void OnNotifyResponse(unsigned int symbol, const UrlResponseData& data) {

  }

  virtual void OnNotifyProgress(unsigned int symbol, const ProgressData& data) {
    CString text;
    text.Format(_T("Already:%I64d,Total:%.2lf MB,Speed:%I64d KB/s\n"),
      data.already_bytes, (double)data.total_bytes / (1024*1024), (__int64)data.bytes_per_sec / 1000);
    //OutputDebugString(text);
    hint_.AppendText(text);
    first_position = data.already_bytes;
  }

  virtual void OnNotifyFinished(unsigned int symbol, const FinishData& data) {
    //first_position = 0;
    _asm nop;
  }
};

#endif//_NOTIFY_HANDER_410FF986_D4A4_4939_8C7A_8512D4932E26_
